package com.mars.dao;

import com.mars.Bean.User;
import com.mars.utils.MybatisUtils;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;

public class Mytest {

    @Test
    public void test(){
        SqlSession sqlSession1 = MybatisUtils.getSqlSession();
        SqlSession sqlSession2 = MybatisUtils.getSqlSession();

        UserMapper mapper1 = sqlSession1.getMapper(UserMapper.class);
        UserMapper mapper2 = sqlSession2.getMapper(UserMapper.class);
        Long time1 = System.currentTimeMillis();
        User user1 = mapper1.queryUserById(1);
        Long time2 = System.currentTimeMillis();
        System.out.println(time2-time1);
        sqlSession1.close();

        Long time3 = System.currentTimeMillis();
        User user2 = mapper2.queryUserById(1);
        Long time4 = System.currentTimeMillis();
        System.out.println(time4-time3);

        sqlSession2.close();

    }

}
